package com.example.frontweb.web.blog;

import com.example.backblog.pojo.blog.Blog;
import com.example.backblog.vo.ApiResult;
import com.example.frontweb.mapper.BlogMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BlogController {
    @Autowired
    private BlogMapper blogMapper;
    @GetMapping("/getall")
    public ApiResult<Object> getall(int page,int size){
        PageHelper.startPage(page,size);
        List<Blog> blog1 = blogMapper.selectAllBlogInformation();
        PageInfo<Blog> pageInfo = new PageInfo<>(blog1);
        return ApiResult.success(pageInfo);
    }
}
